<template>
	<view class="index" v-if="info">
		<global-contact></global-contact>
		<view class="first">
			<view class="head">
				<image src="https://www.atuanjian.com/appletStatic/static/a1.png" mode=""></image>
			</view>
			<view class="article">
				<view class="txt">
					<rich-text :nodes="info.about"></rich-text>
				</view>
			</view>
		</view>
		<view class="first">
			<view class="head">
				<image src="https://www.atuanjian.com/appletStatic/static/a2.png" mode=""></image>
			</view>
			<view class="article"> 
			 <view class="txt">
				<rich-text :nodes="info.culture"></rich-text>
			 </view>
			</view>
		</view>
		<view class="first">
			<view class="head">
				<image src="https://www.atuanjian.com/appletStatic/static/a2.png" mode=""></image>
			</view>
			<view class="article"> 
			 <view class="txt">
				 <view class="imgList">
				 	<view class="item" v-for="(item,index) in info.business_list">
				 		<image :src="showImg+item.img" mode="aspectFit"></image>
						<text>{{item.title}}</text>
				 	</view>
				 </view>
				 <rich-text :nodes="info.business_content"></rich-text>
			 </view>
			</view>
		</view>
		<view class="first">
			<view class="head">
				<image src="https://www.atuanjian.com/appletStatic/static/a2.png" mode=""></image>
			</view>
			<view class="article"> 
			 <view class="txt">
				 <view class="imgList flex_left">
				 	<view class="item small" v-for="(item,index) in info.serve">
				 		<image :src="showImg+item.img" mode="aspectFit"></image>
						<text>{{item.title}}</text>
				 	</view>
				 </view> 
			 </view>
			</view>
		</view>
		<view class="first">
			<view class="head">
				<image src="https://www.atuanjian.com/appletStatic/static/a2.png" mode=""></image>
			</view>
			<view class="article"> 
			 <view class="txt">
				 <view class="imgList flex_left">
				 	<view class="item small" v-for="(item,index) in info.customer">
				 		<image :src="showImg+item.img" mode="aspectFit"></image>
						<text>{{item.url}}</text>
				 	</view>
				 </view> 
			 </view>
			</view>
		</view>
	</view>
</template>

<script>
	import {aboutUs,categoryIndex} from '@/utils/request.js'
	export default {
		data() {
			return { 
				showImg:'',
				info:null
			}
		},
		methods: {
			async categoryIndex(){
				return await categoryIndex()
			},
			getCategory(){
				this.categoryIndex().then(res=>{ 
					res.menu.forEach(val=>{
						if(val.text=='关于我们'){ 
							this.getUserInfo(val.url.split('=')[1])
						}
					})
				}).catch(err=>{
					console.log(err)
				})
			},
			async aboutUs(data){
				return await aboutUs(data)
			},
			getUserInfo(cat_id){
				let data={cat_id}
				this.aboutUs(data).then(res=>{ 
					this.info=res
				}).catch(err=>{
					console.log('err',err)
				})
			} 
		},
		onLoad() {
			this.showImg=this.$config.showImgApi;  
			this.getCategory()
		}
	}
</script>

<style lang="scss">
	.index{
		padding:52rpx 40rpx 40rpx;
		.first{
			margin-bottom: 52rpx;
			.head{
				text-align: center;
				image{
					width: 538rpx;
					height: 44rpx; 
					margin: 0 auto 26rpx;
				}
			}
			.article{
				.txt{
					font-size: 22rpx;
					font-family: PingFang SC;
					font-weight: 400;
					line-height: 44rpx;
					color: #1A1A1A;
				}
			}
		}
		.seconds{
			.head{
				text-align: center;
				image{
					width: 538rpx;
					height: 44rpx; 
					margin: 0 auto 26rpx;
				}
			}	
			.article{
				.item{
					font-size: 22rpx;
					font-family: PingFang SC;
					font-weight: 400;
					line-height: 44rpx;
					color: #1A1A1A;
				}
				.item:before{
					content: '';
					display: inline-block;
					width: 20rpx;
					height: 20rpx;
					background-color: #FFB850;
					margin-right: 10rpx;
				}
			}
		}
	}
	.imgList{
		display: flex;
		justify-content: space-between;
		align-items: center;
		flex-flow: row wrap;
		.item{
			width: 45%;
			display: flex;
			justify-content: flex-start;
			align-items: center;
			flex-direction: column;
			text-align: center;
			margin-bottom: 10rpx;
			image{
				width: 350rpx;
				height: 175rpx;
				margin-bottom: 10rpx;
			}
		}
		.small{
			width: 20%;
			image{
				width: 100rpx;
				height: 100rpx;
				margin-bottom: 10rpx;
			}
		}
	}
	.flex_left{
		justify-content: flex-start;
	}
</style>
